<?php

namespace App\Http\Resources\Kms\User;

use App\Http\Resources\BaseResource;
use Illuminate\Http\Request;

class UserResource extends BaseResource
{
    /**
     * @param Request $request
     * @return array
     */
    public function toArray($request): array
    {
        return [
            "rmsUserId"          => $this->rmsUserId,
            "mobile"             => $this->mobile,
            "avatar"             => $this->avatar,
            "name"               => $this->name,
            "nickname"           => $this->nickname,
            "departmentName"     => $this->departmentName,
            "jobTitle"           => $this->jobTitle,
            "fieldSwitch"        => (bool)attributeGet($this, "userConfigRel.fieldSwitch", 0),
            "equipment"          => attributeGet($this, "lastLoginHistory.equipment", ""),
            "parentDepartmentId" => $this->parentDepartmentId,
            "rootDepartmentName" => $this->rootDepartmentName
        ]; // TODO: Change the autogenerated stub
    }
}
